home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Python 1.4 / Python 1.4 source / Demo / tkinter / matt / 00-HELLO-WORLD.py next >
Encoding:
Python Source  |  1996-08-02  |  624 b   |  28 lines  |  [TEXT/Pyth]

  1. from Tkinter import *
  2.  
  3. # note that there is no explicit call to start Tk. 
  4. # Tkinter is smart enough to start the system if it's not already going. 
  5.  
  6. class Test(Frame):
  7.     def printit(self):
  8.     print "hi"
  9.  
  10.     def createWidgets(self):
  11.     self.QUIT = Button(self, text='QUIT', foreground='red', 
  12.                command=self.quit)
  13.     
  14.     self.QUIT.pack(side=LEFT, fill=BOTH)
  15.  
  16.     # a hello button
  17.     self.hi_there = Button(self, text='Hello', 
  18.                    command=self.printit)
  19.     self.hi_there.pack(side=LEFT)
  20.  
  21.     def __init__(self, master=None):
  22.     Frame.__init__(self, master)
  23.     Pack.config(self)
  24.     self.createWidgets()
  25.  
  26. test = Test()
  27. test.mainloop()
  28.